package tiled.simple.gwt.client;


import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;


public class Controls implements KeyDownHandler,KeyUpHandler{

	public boolean left=false;
	public boolean right=false;
	public boolean up=false;
	public boolean upReleased=true;

	
	public Controls(){
	}
	
	
	public void onKeyDown(KeyDownEvent event) {
		if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT)  {left =true;}
		if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) {right=true;}
		if (event.getNativeKeyCode() == KeyCodes.KEY_UP)    {up   =true;}
	}

	public void onKeyUp(KeyUpEvent event) {
		if (event.getNativeKeyCode() == KeyCodes.KEY_LEFT)  {left =false;}
		if (event.getNativeKeyCode() == KeyCodes.KEY_RIGHT) {right=false;}
		if (event.getNativeKeyCode() == KeyCodes.KEY_UP)    {up   =false;}
	}

}
